﻿using System.Net;

namespace PacketRush.Core
{
    /// <summary>
    /// Client-side networking providers implement the IClientNetworkingProvider interface
    /// in order to connect, send and receive messages over a networking protocol.
    /// </summary>
    /// <remarks>
    /// <see cref="PacketRush.Core.NetClient"/> uses an implementation of IClientNetworkingProvider
    /// for sending, receiving and connecting, this allows a pluggable underlying communication layer without
    /// effecting the core logic that NetClient provides to the application.
    /// </remarks>
    public interface IClientNetworkingProvider : INetworkingProvider
    {
        /// <summary>
        /// Connect to a remote end point
        /// </summary>
        /// <param name="remoteEndPoint">The remote end point to connect to</param>
        void Connect(EndPoint remoteEndPoint);

        /// <summary>
        /// Returns a connection if a connection is made, NetClient polls this method
        /// until a connection is returned.
        /// </summary>
        /// <returns>An implementation of <see cref="PacketRush.Core.INetConnection"/></returns>
        INetConnection AcceptConnection();
    }
}
